package edu.bu.cs673.superkids123.parents.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import edu.bu.cs673.superkids123.common.model.Achievement;
import edu.bu.cs673.superkids123.common.model.Child;

@Entity
@Table(name="images")
public class Image {
	/**
	 * @author Abdelghani Bhalla
	 */
	@Id @GeneratedValue
	@Column(name="ImageId")
	private int id;
	
	@Column(name="ImageName")
	private String name;
	
	@Column(name="ImageFileName")
	private String fileName;
	
	@OneToMany(mappedBy="image")
	private Set<Number> numbers = new HashSet<Number>();
	
	@OneToMany(mappedBy="image", fetch=FetchType.EAGER)
	private Set<Child> children = new HashSet<Child>();
	
	@OneToMany(mappedBy="image", fetch=FetchType.LAZY)
	private Set<Achievement> achievements = new HashSet<Achievement>();

	public Set<Achievement> getAchievements() {
		return achievements;
	}

	public void setAchievements(Set<Achievement> achievements) {
		this.achievements = achievements;
	}

	public Set<Child> getChildren() {
		return children;
	}

	public void setChildren(Set<Child> children) {
		this.children = children;
	}

	public Set<Number> getNumbers() {
		return numbers;
	}

	public void setNumbers(Set<Number> numbers) {
		this.numbers = numbers;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public void addChild(Child c)
	{
		c.setImage(this);
		children.add(c);
	}
	public Image(String name,String fileName)
	{
		this.name = name;
		this.fileName = fileName;
	}
	
	public void addNumber(Number n)
	{
		n.setImage(this);
		numbers.add(n);
	}
	public Image()
	{
		
	}


}
